﻿using Client.Framework.Message;
using Client.Model;
using Google.Protobuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.Message.Request
{
    class PermissonListReq : RequestBaseMessage
    {
        public PermissonListReq(int msgId) : base(msgId)
        {

        }

        public int Page { get; set; }

        public int Limit { get; set; }

        public ViewPermisson Condition { get; set; }

        public override byte[] Serialize()
        {
            RequestPermissionList msg = new RequestPermissionList()
            {
                Page = Page,
                Limit = Limit
            };
            if (Condition != null)
            {
                msg.Condition.Id = Condition.ID;
                msg.Condition.PerCode = Condition.PerCode ?? string.Empty;
                msg.Condition.Status = (int)Condition.Status;
            }
            return msg.ToByteArray();
        }
    }
}
